I have the same problem.
This is 100% cloud kit sync causing issues. When I configure my model not to use cloud kit everything is perfect. But when I turn it back on glitches happen.
Here is the code you can use to test:
let configuration = ModelConfiguration(
isStoredInMemoryOnly: false,
allowsSave: true,
cloudKitDatabase: isSyncOff
? .none // <- NO GLITCHES
: .private(Cloud.identifier) // <- Hangs and lags
)
I have also noticed error messaged reported by CloudKit:
Publishing changes from background threads is not allowed; make sure to publish values from the main thread (via operators like receive(on:)) on model updates.
There seems to be a threading issue internally. Maybe some stuff runs on Main Thread while updates are not. Maybe the fact that background queue is trying to update on the main queue is causing the glitching. However, I did not find a workaround.
I have managed to minimize the effect by turning of automatic saving on the ManagedContext and only when needed calling the .save() and checking using .hasChanges(). However, that did not help solve the issue of lagging UI when the app moves to active scenePhase since the CloudKit sync will trigger on scenePhase change on its own.
I am not sure what else to do then to wait for a fix from Apple...
If you have a solution please share it this is making my app experience for users horrible.
Post
Replies
Boosts
Views
Activity
I have tested this on a real device and have the same problem as the original post.
watchOS 10.4
Model A2984